*Replication Do File for “Perceptions of Partisanship in Local American Politics”
*Todd Makse and Patrick Villalonga
*July 2025

*Main Manuscript
use "C:\Makse Villalonga Replication Dataset.dta"
*Table 1: Characteristics of Cities in Sample
tab citycode if mismatch==0 & polknow_search==0 & wave==1

*Table 2: Summary Statistics
sum partisan_loc age homeown loc_media female biden_pct zcta_herf np_elecs mun_id i.eth i.educ4 i.pid3 if mismatch==0 & polknow_search==0 & wave==1

*Figure 1: Proportion Perceiving Local Politics as Less Partisan, by City and Party ID
graph dot partisan_loc_d if mismatch==0 & polknow_search==0 & wave==1, over(pid3) by(citycode) yline(.45, lcolor(black)) exclude0 xsize(10)

*Table 3: Ordered Logit Models of Perceiving Local Politics as Less Partisan
*Model 1
ologit partisan_loc age homeown loc_media i.educ4 female ib4.eth i.pid3##c.biden_pct zcta_herf np_elecs mun_id if mismatch==0 & polknow_search==0, cl(citycode)
*Model 2
ologit partisan_loc age homeown loc_media i.educ4 female ib4.eth i.pid3##c.biden_pct zcta_herf np_elecs mun_id if mismatch==0 & polknow_search==0 [aweight=weight], cl(citycode)

*Figure 2: Predicted Probability of Agreement that Local Politics is Less Partisan
ologit partisan_loc age homeown loc_media i.educ4 female ib4.eth i.pid3##c.biden_pct zcta_herf np_elecs mun_id if mismatch==0 & polknow_search==0, cl(citycode)
margins, at(biden=(0.522 0.659 0.785) pid3=(0 1 2)) expression(predict(outcome(2))+predict(outcome(3)))
marginsplot, recastci(rarea)

*Figure 3: Distribution of Responses by Question Wording
graph hbar  if wave==2 [aweight=weight], over(partisan_loc)
graph hbar if wave==2 [aweight=weight], over(partisan_loc2) 
graph hbar if wave==2 [aweight=weight], over(partisan_loc3)

*Appendix

*Table A-1
use "C:\Makse Villalonga City Sample Representativeness.dta"
ttest totpop, by(wave1)
ttest whitepct, by(wave1)
ttest blackpct, by(wave1)
ttest asianpct, by(wave1)
ttest hisppct, by(wave1)
ttest femalepct, by(wave1)
ttest medage, by(wave1)
ttest baplus, by(wave1)
ttest medinc, by(wave1)
ttest marrpct, by(wave1)

*Figure A-1
use "C:\Makse Villalonga Within City Representativeness.dta"
graph dot actual survey if citycode==32, over(varnum) leg(off)
graph dot actual survey if citycode==38, over(varnum) leg(off)
graph dot actual survey if citycode==40, over(varnum) leg(off) 
graph dot actual survey if citycode==43, over(varnum) leg(off) 
graph dot actual survey if citycode==46, over(varnum) leg(off) 
graph dot actual survey if citycode==74, over(varnum) leg(off) 
graph dot actual survey if citycode==78, over(varnum) leg(off) 
graph dot actual survey if citycode==85, over(varnum) leg(off) 
graph dot actual survey if citycode==92, over(varnum) leg(off) 

*Scatterplots
*Calculate means by city and create separate data file
tabstat partisan_loc if mismatch==0 & polknow_search==0 & philly_error!=1, by(citycode)
use "C:\Makse Villalonga Means by City.dta"
*Figure A-2
graph dot (mean) partisan_loc, over(citycode) over(off) nofill ylabel(1 (0.25) 2) exclude0
*Figure A-3
graph dot (mean) partisan_loc , over(citycode) over(mayorcouncil) nofill ylabel(1 (0.25) 2) exclude0
*Figure A-4
twoway scatter partisan_loc ig, mlabel(citycode) mlabv(pos)
*Figure A-5
twoway scatter partisan_loc seg, mlabel(citycode) mlabv(pos2) xscale(range(-20 10)) xlabel(-20 (5) 10)

*Table A-3: Comparison of P-Values, by Standard Error Estimation Strategy
use "C:\Makse Villalonga Replication Dataset.dta"
ologit partisan_loc age homeown loc_media i.educ4 female ib4.eth i.pid3##c.biden_pct zcta_herf np_elecs mun_id if mismatch==0 & polknow_search==0, cl(citycode)
boottest mun_id
boottest age
boottest female
boottest 1.pid3#biden_pct
boottest 2.pid3#biden_pct
boottest 1.pid3
boottest 2.pid3
boottest biden
boottest zcta
boottest loc
boottest homeown
boottest np
boottest 1.educ
boottest 2.educ
boottest 3.educ
boottest 1.eth
boottest 2.eth
boottest 3.eth
boottest 5.eth

ologit partisan_loc age homeown loc_media i.educ4 female ib4.eth i.pid3##c.biden_pct zcta_herf np_elecs mun_id if mismatch==0 & polknow_search==0 [aweight=weight], cl(citycode)
boottest mun_id
boottest age
boottest female
boottest 1.pid3#biden_pct
boottest 2.pid3#biden_pct
boottest 1.pid3
boottest 2.pid3
boottest biden
boottest zcta
boottest loc
boottest homeown
boottest np
boottest 1.educ
boottest 2.educ
boottest 3.educ
boottest 1.eth
boottest 2.eth
boottest 3.eth
boottest 5.eth

*Table A-4: Predicted Probabilities of Response Outcomes, by Key Independent Variables
ologit partisan_loc age homeown loc_media i.educ4 female ib4.eth i.pid3##c.biden_pct zcta_herf np_elecs mun_id if mismatch==0 & polknow_search==0, cl(citycode)
margins, at(biden=(0.522 0.659 0.785) pid3=(0 1 2)) 
margins, at(mun=(4 10)) 

*Table A-5: Alternative Ordered Logit Models of Perceiving Local Politics as Less Partisan
*Less inclusive partisanship measure (Column 1)
ologit partisan_loc age homeown loc_media i.educ4 female ib4.eth i.pid3a##c.biden_pct zcta_herf np_elecs mun_id if mismatch==0 & polknow_search==0 & wave==1, cl(citycode)
*Alternative measure of local politics (2016 instead of 2020) (Column 2)
ologit partisan_loc age homeown loc_media i.educ4 female ib4.eth i.pid3##c.biden16_pct zcta_herf np_elecs mun_id if mismatch==0 & polknow_search==0, cl(citycode)

*Table A-6
ologit partisan_loc age homeown loc_media i.educ4 female ib4.eth i.pid3##c.biden_pct zcta_herf np_elecs2 mun_id if mismatch==0 & polknow_search==0, cl(citycode)

*Table A-7: Interactions between Question Forms and Key Covariates
generate gop_dcity = 0
replace gop_dcity = 1 if wave==2 & biden_pct>.7 & pid3a==1
generate ploc_term=.
replace ploc_term=0 if partisan_loc3!=.
replace ploc_term=1 if partisan_loc2!=.
generate ploc_dummy=.
replace ploc_dummy = 1 if inlist(partisan_loc,2,3)
replace ploc_dummy = 1 if inlist(partisan_loc2,3,4)
replace ploc_dummy = 0 if inlist(partisan_loc,0,1)
replace ploc_dummy = 0 if inlist(partisan_loc2,0,1,2)

generate ploc_bal=.
replace ploc_bal=0 if wave==2 & partisan_loc!=.
replace ploc_bal=1 if wave==2 & partisan_loc2!=.
generate ploc_comb = .
replace ploc_comb = partisan_loc2 if partisan_loc2!=.
replace ploc_comb = partisan_loc3 if partisan_loc3!=.

*For the unbalanced vs. balanced distinction
logit ploc_dummy age homeown loc_media i.educ4 female ib4.eth c.ploc_bal##c.gop_dcity zcta_herf np_elecs c.ploc_bal##c.mun_id if wave==2 & mismatch==0 & polknow_search==0 & philly_error!=1 , cl(citycode)

*For the partisan vs. divisive distinction
ologit ploc_comb age homeown loc_media i.educ4 female ib4.eth c.ploc_term##c.gop_dcity zcta_herf np_elecs c.ploc_term##c.mun_id if mismatch==0 & polknow_search==0 & philly_error!=1, cl(citycode)
